<ul class="list-group list-group-flush">
    <a href="/app/laoha/post" class="list-group-item <?=empty(request()->input('cate_id'))?'active':'' ?>">所有内容</a>
    
    <?php 
   
    
    foreach($cates as $k=>$v){
        $groups = [];
        $cids = empty($v['cids'])?'':arr2str($v['cids']);
        $id = ($v['is_publish']==0 && $cids)  ? 'in,'.arr2str($v['cids']):$v['id'];
        if(request()->input('cate_id','') == $id){
            $active = ' active';
            if($v['is_publish'] && $v['groups']){
                $groups=str2arr($v['groups']);
                $gc_id = $v['id'];
            }
        }else{
            $active = '';
        }
        $active = request()->input('cate_id','') == $id ? ' active':'';
        
        $url = '/app/laoha/post?cate_id='.$id;
        $title = $v['title'];
        
        //$ms = ($v['level']>1) ? 'ps-'.($v['level']-1)*4 : '';
        $ms = ($v['level']>1) ? 'ps-'.($v['level']-1)*4 : '';
        $ps = ($v['level']>1) ? 'padding-left: '.(($v['level']-1)*32).'px;' : '';
        echo "<a href='$url' class='list-group-item  $active' style='".$ps."'>$title</a>".PHP_EOL;
        if(!empty($groups)){
            echo '<p class="my-1 px-3">';
            foreach($groups as $g){
                $gactive = request()->input('group','') == $g ? 'active' : '';
                echo '<a href="/app/laoha/post?cate_id='.$gc_id.'&group='.$g.'" class="btn btn-sm  btn-outline-primary m-1 '.$gactive.'">'.$g.'</a>'.PHP_EOL;
            }
            echo '</p><hr class="border-1 my-1">';
        }
    }

    

    ?>
</ul>